function truncate(n, m)
    return n == 0 ? 0 : to_integer(n/math.pow(10, math.max(to_integer(math.log10(math.abs(n))) - math.max(m, 0) + 1, 0)))
end
system.out.println(truncate(-1234, 1))
system.out.println(truncate(-1234, 2))
system.out.println(truncate(-1234, 3))
system.out.println(truncate(1234, 1))
system.out.println(truncate(1234, 2))
system.out.println(truncate(1234, 3))
system.out.println(truncate(4567, 1))
system.out.println(truncate(4567, 2))
system.out.println(truncate(4567, 3))
system.out.println(truncate(7890, 1))
system.out.println(truncate(7890, 2))
system.out.println(truncate(7890, 3))
